package com.hibase.core.mybatis.config;

import cn.hutool.core.util.NumberUtil;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.hibase.core.mybatis.util.GenerateIdHelper;

/**
 * 主键id 雪花算法
 * @author chenfeng
 * @version 1.0
 * @date 2021/11/3 15:41
 * @des https://gitee.com/cheershi
 */
public class CustomIdGenerator implements IdentifierGenerator {
    @Override
    public Number nextId(Object entity) {
        return NumberUtil.parseNumber(GenerateIdHelper.idGenerate());
    }
}
